package com.cincc.cinccimdemo.viewholder;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.cincc.cinccimdemo.R;
import com.cincc.cinccimdemo.adapter.ConversationAdapter;
import com.cincc.cinccimdemo.common.FileUtils;
import com.cincc.cinccimdemo.model.MessageInfoUI;
import com.cincc.im.model.enums.SendStatus;
import com.cincc.im.model.message.ImCardMessage;
import com.cincc.im.model.message.ImFileMessage;

public class SendCardHolder extends MessageContentHolder {
    public ImageView iv_face;
    public ImageView iv_message;
    public TextView tv_time;
    public ImageView iv_error;
    public ProgressBar pb_loading;
    public RelativeLayout rl_message;
    public ImageView iv_avatar;
    public TextView tv_name;

    public SendCardHolder(Context context, View itemView, ConversationAdapter adapter) {
        super(context, itemView, adapter);
        iv_face = itemView.findViewById(R.id.iv_face);
        iv_message = itemView.findViewById(R.id.iv_message);
        tv_time = itemView.findViewById(R.id.tv_time);
        iv_error = itemView.findViewById(R.id.send_error_image);
        pb_loading = itemView.findViewById(R.id.progress);
        rl_message = itemView.findViewById(R.id.rl_message);
        tv_name = itemView.findViewById(R.id.name_tv);
        iv_avatar = itemView.findViewById(R.id.avatar_img);
    }

    @Override
    public void bindView(MessageInfoUI uiMessage, int position) {
        super.bindView(uiMessage, position);
        ImCardMessage imFileMessage = (ImCardMessage) uiMessage.getMessageInfo().imMessage;
        tv_name.setText(imFileMessage.name);
        pb_loading.setVisibility(uiMessage.getMessageStatus() == SendStatus.SEND_ING ? View.VISIBLE : View.GONE);
    }
}
